<?php

namespace App\Jobs;

use App\Jobs\Job;
use App\Models\Appointment;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class PayOrder extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;
    protected $id;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($id)
    {
        $this->id = $id;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(Appointment $appointment)
    {
        tolog('队列执行顺序2：'.time());
//        $appointment->addOrder($this->params);
        $appointmentInfo = $appointment->getone(['id'=>$this->id]);
        $where['doctor_id'] = $appointmentInfo['doctor_id'];
        $where['depart_id'] = $appointmentInfo['depart_id'];
        $where['mark_time'] = $appointmentInfo['mark_time'];
        $appointment->getSnycOrderInfo($where);
        tolog('队列执行顺序3：'.time());
    }
}
